package com.kedi.healthcenter.read.dao.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;


/**
 * 
* @Description: 营养健康模块
* @author: dw 
* @date: 2019 2019年7月27日 下午11:07:36
 */
@Mapper
public interface HealthFoodMapper {
	
	/**
	 * 根据用户id，获取对应的健康食物
	 * @param 			puserid
	 * @return			
	 */
	@Select("SELECT COUNT(e.p_user_id) as total_size,* FROM "
			+ "elderly_health e "
			+ "LEFT JOIN health_food r ON e.elderly_health_id = r.elderly_health_id "
			+ "LEFT JOIN food f ON r.food_id = f.food_id "
			+ "LEFT JOIN food_image i ON f.food_id = i.food_id "
			+ "WHERE e.p_user_id = #{puserid} "
			+ "ORDER BY e.elderly_health_id ASC "
			+ "LIMIT  #{page},#{limit};")
	List<Map<String, Object>> oldFoods(@Param("puserid")int puserid,@Param("page")int page,@Param("limit")int limit);
}
